package com.ww.springboot.sharding.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Data;

import java.io.Serializable;
import java.time.Instant;
import java.util.Date;

/**
 * @author wanwei
 * @since 2021/5/3
 */
@Data
@TableName("zh_order_details")
public class OutOrderDetailsEntity implements Serializable {
    /**
     * 主键
     */
    public Long id;

    @JsonAlias(value = "o_id")
    @TableField(value = "o_id")
    public Long oId;

    @TableField(value = "o_tracknumber")
    @JsonAlias(value = "o_tracknumber")
    public String tracknumber; //运单号

    @TableField(value = "o_tracknumber_ex")
    @JsonAlias(value = "o_tracknumber_ex")
    public String tracknumberEx; //客户单号

    @TableField(value = "o_logistics_group_id")
    @JsonAlias(value = "o_logistics_group_id")
    public Long logisticsGroupId; //发货组

    @TableField(value = "o_logistics")
    @JsonAlias(value = "o_logistics")
    public String logistics; //物流号

    @TableField(value = "o_platform_id")
    @JsonAlias(value = "o_platform_id")
    public Long platformId; //平台id

    @TableField(value = "o_account")
    @JsonAlias(value = "o_account")
    public String account; //账户

    @TableField(value = "o_country")
    @JsonAlias(value = "o_country")
    public String country; //所在地区

    @TableField(value = "o_outstock_time")
    @JsonAlias(value = "o_outstock_time")
    public Date outstockTime; //出货时间

    @TableField(value = "o_paid_time")
    @JsonAlias(value = "o_paid_time")
    public Date paidTime; //付费时间

    @TableField(value = "o_pbd_time")
    @JsonAlias(value = "pbd_time")
    public Date pbdTime; //扫描时间

    @TableField(value = "di_id")
    @JsonAlias(value = "di_id")
    public Long diId; //物流商id

    @TableField(value = "di_shortname")
    @JsonAlias(value = "di_shortname")
    public String diShortname; //物流商简称

    @TableField(value = "o_first_time")
    @JsonAlias(value = "o_first_time")
    public Date firstTime; //创建时间

    @TableField(value = "o_trajectory_type")
    @JsonAlias(value = "o_trajectory_type")
    public Integer trajectoryType; //轨迹状态

    @TableField(value = "o_delay_type")
    @JsonAlias(value = "o_delay_type")
    public Integer delayType;

    @TableField(value = "o_sign_day")
    @JsonAlias(value = "o_sign_day")
    public Double signDay;

    /**
     * 订单轨迹抓取失败次数
     */
    @TableField(value = "o_failed_num")
    @JsonAlias(value = "o_failed_num")
    public Integer failedNum;

    public void setOutstockTime(Date outstockTime) {
        this.outstockTime = outstockTime;
    }

    public void setOutstockTime(String outstockTime) {
        Instant instant = Instant.ofEpochMilli(Long.parseLong(outstockTime + "000"));
        this.outstockTime = Date.from(instant);

    }

    public void setPaidTime(Date paidTime) {
        this.paidTime = paidTime;
    }

    public void setPaidTime(String paidTime) {
        Instant instant = Instant.ofEpochMilli(Long.parseLong(paidTime + "000"));
        this.paidTime = Date.from(instant);
    }


    public void setPbdTime(String pbdTime) {
        Instant instant = Instant.ofEpochMilli(Long.parseLong(pbdTime + "000"));
        this.pbdTime = Date.from(instant);
    }

    public void setPbdTime(Date pbdTime) {
        this.pbdTime = pbdTime;
    }


}
